from fdfs_client.client import Fdfs_client

import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

cnf = os.path.join(BASE_DIR,'utils/fastdfs/client.conf')
FDFS_Client = Fdfs_client(cnf)


if __name__ == '__main__':
    try:
        img = os.path.join(BASE_DIR, 'media/linux.jpg')

        ret = FDFS_Client.upload_by_filename(img)
    except Exception as e:
        print("fdfs测试异常：{}".format(e))
    else:
        print(ret)
